package com.cmii.sjw.department.control.jsc.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cmii.sjw.department.control.jsc.mapper.SchoolNumMapper;
import com.cmii.sjw.department.control.jsc.model.SchoolNum;
import com.cmii.sjw.department.control.jsc.service.SchoolNumService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

@Service
public class SchoolNumServiceImpl extends ServiceImpl<SchoolNumMapper, SchoolNum> implements SchoolNumService {

    @Override
    public SchoolNum getByCountyName(String countyName) {
        return lambdaQuery()
                .eq(StringUtils.isNotBlank(countyName), SchoolNum::getOrganizationName, countyName)
                .eq(SchoolNum::getIsDeleted, 0)
                .last("limit 1")
                .one();
    }
}